#include "stdio.h"

void main()
{
	int shu[500001];
	long int i,j,n;

	for (i=0;i<=500000;i++) shu[i]=0;
	for (i=2;i<=250000;i++)
	{
		for (j=i+i;j<=500001;j+=i)
			shu[j]+=i;
	}
	scanf("%d",&j);
	for (i=1;i<=j;i++)
	{
	        scanf("%d",&n);
		if (n==1) printf("0\n");
		else printf("%d\n",shu[n]+1);   
	}
}
